package com.liuwei.desktop.common;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class FileUtils {
	
	public static List<String> getRows(String path) throws IOException {
		List<String> rows = new ArrayList<>();
		// read file content from file
		InputStreamReader reader = new InputStreamReader(new FileInputStream(path),"GB2312");
		BufferedReader br = new BufferedReader(reader);

		String str = null;
		while ((str = br.readLine()) != null) {
			str = str.trim(); 
			rows.add(str);
			System.out.println(str);
		}
		br.close();
		reader.close();
		return rows;
	}
}
